home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok52
/
abitur
/
txt
/
intufrage.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
6KB
|
214 lines
IMPLEMENTATION MODULE IntuFrage;
FROM Intuition IMPORT Gadget, BoolInfo, StringInfo, IntuiText,
RefreshGadgets, IntuiMessage, IntuiMessagePtr,
IDCMPFlagSet, IDCMPFlags,
GadgetFlagSet, GadgetFlags,
ActivationFlagSet, ActivationFlags,
boolGadget, strGadget, boolMask,
gadgHNone, ActivateGadget,
ClearMenuStrip, SetMenuStrip, MenuPtr;
FROM Graphics IMPORT Move, Text, DrawModes, DrawModeSet, SetAPen,
Draw, FontStyleSet, FontStyles,
AskSoftStyle, SetSoftStyle;
FROM Exec IMPORT WaitPort, GetMsg, ReplyMsg;
FROM Fragen IMPORT FragePtr, SchuelerAntwort;
FROM AbiturScreen IMPORT BACKWindow, TafelPutz;
FROM SYSTEM IMPORT ADR, ADDRESS, LONGSET;
FROM Str IMPORT Length, Copy;
FROM Arts IMPORT BreakPoint;
VAR i : INTEGER;
MyStrGadget: Gadget;
MyStrInfo : StringInfo;
MyOKGadget : Gadget;
MyOKText : IntuiText;
MyBoolGad : ARRAY[1..6] OF Gadget;
StringBuffer,UndoBuffer: ARRAY[0..255] OF CHAR;
PROCEDURE IntuFrag(Fra: FragePtr; VAR Antw: SchuelerAntwort);
(* Stellt die Frage Fra auf der Tafel,
* erwartete die Antwort in Antw.
* Nötigenfalls werden die Gadgets abgefragt.
* Jedenfalls greifft die Procedur auf Abiturscreen zu
*)
VAR IAddress (* , Adr *): ADDRESS;
imPtr: IntuiMessagePtr;
Class: IDCMPFlagSet;
AMaske, NMaske: FontStyleSet;
TempMenuPtr: MenuPtr;
BEGIN
TafelPutz;
StringBuffer[0] := 0C;
BACKWindow^.firstGadget := ADR(MyStrGadget);
FOR i := 1 TO 6 DO
EXCL(MyBoolGad[i].flags, selected)
END;
RefreshGadgets(ADR(MyStrGadget), BACKWindow, NIL);
IF ActivateGadget(ADR(MyStrGadget), BACKWindow, NIL) THEN END;
TempMenuPtr := BACKWindow^.menuStrip;
ClearMenuStrip(BACKWindow);
(* Kästchen um die Gadgets *)
SetAPen(BACKWindow^.rPort, 7);
FOR i := 1 TO 6 DO
Move(BACKWindow^.rPort, 161, 8 + 9*i);
Draw(BACKWindow^.rPort, 167, 8 + 9*i);
Draw(BACKWindow^.rPort, 167, 14 + 9*i);
Draw(BACKWindow^.rPort, 161, 14 + 9*i);
Draw(BACKWindow^.rPort, 161, 8 + 9*i)
END;
(* Kasten um StringGadget *)
SetAPen(BACKWindow^.rPort, 7);
Move(BACKWindow^.rPort, 163, 83);
Draw(BACKWindow^.rPort, 277, 83);
Draw(BACKWindow^.rPort, 277, 94);
Draw(BACKWindow^.rPort, 163, 94);
Draw(BACKWindow^.rPort, 163, 83);
(* Kasten um OK Gadget *)
SetAPen(BACKWindow^.rPort, 7);
Move(BACKWindow^.rPort, 296 , 83);
Draw(BACKWindow^.rPort, 296 + 18, 83);
Draw(BACKWindow^.rPort, 296 + 18, 94);
Draw(BACKWindow^.rPort, 296 , 94);
Draw(BACKWindow^.rPort, 296 , 83);
SetAPen(BACKWindow^.rPort, 1);
AMaske := AskSoftStyle(BACKWindow^.rPort);
NMaske := SetSoftStyle(BACKWindow^.rPort, FontStyleSet{italic}, AMaske);
FOR i := 0 TO 10 DO
Fra^.Txt[i][18] := 0C;
Move(BACKWindow^.rPort, 6, 23 + 9 * i);
Text(BACKWindow^.rPort, ADR(Fra^.Txt[i]), Length(Fra^.Txt[i]))
END;
SetAPen(BACKWindow^.rPort, 7);
NMaske := SetSoftStyle(BACKWindow^.rPort, FontStyleSet{}, AMaske);
FOR i := 1 TO 6 DO
Fra^.MultipleAntw[i][18] := 0C;
Move(BACKWindow^.rPort, 170, 14 + 9 * i);
Text(BACKWindow^.rPort, ADR(Fra^.MultipleAntw[i]),
Length(Fra^.MultipleAntw[i]))
END;
REPEAT
WaitPort(BACKWindow^.userPort);
imPtr := GetMsg(BACKWindow^.userPort);
Class := imPtr^.class;
IAddress := imPtr^.iAddress;
ReplyMsg(imPtr);
(* BreakPoint(ADR("In WaitLoop")) *)
UNTIL (gadgetUp IN Class)
AND ((IAddress = ADR(MyOKGadget)) OR (IAddress = ADR(MyStrGadget)));
(* BELEGEN *)
Copy(Antw.Str, StringBuffer);
Antw.Mul := {};
FOR i := 1 TO 6 DO
IF selected IN MyBoolGad[i].flags THEN
INCL(Antw.Mul, i-1)
END
END;
IF SetMenuStrip(BACKWindow, TempMenuPtr) THEN END;
BACKWindow^.firstGadget := NIL;
RefreshGadgets(NIL, BACKWindow, NIL);
TafelPutz
END IntuFrag;
BEGIN (* IntuFrage InitialisationsTeil *)
StringBuffer[0] := 0C;
WITH MyStrInfo DO
undoBuffer := ADR(UndoBuffer);
buffer := ADR(StringBuffer);
numChars := Length(StringBuffer);
bufferPos := 0; maxChars := 64;
dispPos := 0; undoPos := 0;
dispCount := 0; cLeft := 0; cTop := 0;
layerPtr := NIL; longInt := 0; altKeyMap := NIL
END;
WITH MyStrGadget DO
nextGadget := ADR(MyOKGadget);
leftEdge := 164;
topEdge := 85;
width := 115;
height :=10;
flags := GadgetFlagSet{selected};
activation := ActivationFlagSet{relVerify, endGadget, stringCenter};
gadgetType := strGadget;
gadgetRender := NIL;
selectRender := NIL;
gadgetText := NIL;
mutualExclude := LONGSET{};
specialInfo := ADR(MyStrInfo);
gadgetID := 1;
userData := NIL
END; (* WITH StrGadg *)
WITH MyOKText DO
frontPen := 5;
backPen := 4;
drawMode := DrawModeSet{};
leftEdge := 1;
topEdge := 1;
iTextFont := NIL;
iText := ADR("OK");
nextText := NIL
END;
WITH MyOKGadget DO
nextGadget := ADR(MyBoolGad[1]);
leftEdge := 297;
topEdge := 84;
width := 17;
height := 10;
flags := GadgetFlagSet{}; (* Complement *)
activation := ActivationFlagSet{gadgImmediate, relVerify};
gadgetType := boolGadget;
gadgetRender := NIL;
selectRender := NIL;
gadgetText := ADR(MyOKText);
mutualExclude := LONGSET{};
specialInfo := NIL;
gadgetID := 2;
userData := NIL
END; (* WITH OKGadg *)
FOR i := 1 TO 6 DO
WITH MyBoolGad[i] DO
IF i # 6 THEN
nextGadget := ADR(MyBoolGad[i+1])
ELSE (* Letztes GAdget hat keinen Nachfolger *)
nextGadget := NIL
END;
leftEdge := 162;
topEdge := 9*i + 9;
width := 5;
height := 5;
flags := GadgetFlagSet{}; (* Complement *)
activation := ActivationFlagSet
{ relVerify, gadgImmediate, toggleSelect};
gadgetType := boolGadget;
gadgetRender := NIL;
selectRender := NIL;
gadgetText := NIL;
mutualExclude := LONGSET{};
specialInfo := NIL;
gadgetID := i + 2;
userData := NIL
END (* WITH BoolGadgs*)
END
END IntuFrage.